//
//  HNFundManagementDetailView.m
//  优学荟管理系统
//
//  Created by 星道 on 17/9/19.
//  Copyright © 2017年 星道三好. All rights reserved.
//

#import "HNFundManagementDetailView.h"

@implementation HNFundManagementDetailView
{
    void (^_complete)();
    IBOutlet UIView *_contentView;
}



+ (instancetype)Show:(NSString *)SONO userName:(NSString *)userName petName:(NSString *)petName className:(NSString *)className paySONO:(NSString *)paySONO complete:(void (^)())complete {

    return [[self alloc] initWithSONO:SONO userName:userName petName:petName className:className paySONO:paySONO complete:complete];
}

- (instancetype)initWithSONO:(NSString *)SONO userName:(NSString *)userName petName:(NSString *)petName className:(NSString *)className paySONO:(NSString *)paySONO complete:(void (^)())complete {

    self = [[[NSBundle mainBundle] loadNibNamed:[HNFundManagementDetailView description] owner:nil options:nil] lastObject];
    if (self) {

        self.SONO.text = SONO;
        self.userName.text = userName;
        self.petName.text = petName;
        self.className.text = className;
        self.paySONO.text = paySONO;
        _complete = complete;

        self.alpha = 0;
        _contentView.alpha = 0;
        _contentView.hidden = NO;

        self.frame = [UIScreen mainScreen].bounds;
        [[UIApplication sharedApplication].keyWindow addSubview:self];

        [self Show];
    }
    return self;
}








/** 显示 */
- (void)Show {

    [UIView animateWithDuration:0.3 animations:^{
        self.alpha = 1;
    } completion:^(BOOL finished) {
        [UIView animateWithDuration:0.3 animations:^{
            _contentView.alpha = 1;
        }];
    }];
}

/** 关闭 */
- (IBAction)Close:(UIButton *)sender {

    [UIView animateWithDuration:0.3 animations:^{
        self.alpha = 0;
    } completion:^(BOOL finished) {
        _complete ? _complete () : nil;
        [self removeFromSuperview];
    }];
}
@end
